﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace CPPEI.Coolzon.Designer.Views
{
    /// <summary>
    /// Interaction logic for SolutionProperty.xaml
    /// </summary>
    public partial class SolutionProperty : Window
    {
        private Designtime.Metadata.Solution _solution;
        public SolutionProperty(Designtime.Metadata.Solution solution)
        {
            InitializeComponent();
            _solution = solution;
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            tbName.Text = _solution.Name;
            tbCaption.Text = _solution.Caption;
            tbVersion.Text = _solution.RT_Solution.Version.ToString();
            tbRTVersion.Text = _solution.RT_Solution.RuntimeVersion.ToString();
            tbHeight.Text = _solution.DefaultSceneHeight.ToString();
            tbWidth.Text = _solution.DefaultSceneWidth.ToString();
            BindSolutionType(_solution.SolutionType);
        }
        private void BindSolutionType(Designtime.Metadata.SolutionType type)
        {
            foreach (Designtime.Metadata.SolutionType solutionType in Designtime.Metadata.SolutionType.EnumerateTypes())
            {
                ComboBoxItem cbi = new ComboBoxItem();
                cbi.Content = solutionType.Text;
                cbi.Tag = solutionType;
                tbType.Items.Add(cbi);
                if(solutionType == type)
                {
                    tbType.SelectedItem = cbi;
                }
            }
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            DialogResult = true;
        }
    }
}
